package com.lzj.server.entity.video;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lzj.server.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serial;

@Schema(name = "User", description = "用户信息表")
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("user_info")
public class UserInfo extends BaseEntity {
    @Serial
    private static final long serialVersionUID = 151825795084055151L;

    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "主键，自增ID")
    private Long id;

    @TableField("username")
    @Schema(description = "用户名（唯一）")
    private String username;

    @TableField("nickname")
    @Schema(description = "昵称")
    private String nickname;

    @TableField("password")
    @NotBlank(message = "密码不能为空")
    @Schema(description = "密码（加密存储）")
    private String password;

    @TableField("avatar_attachment_id")
    @Schema(description = "用户头像")
    private Long avatarAttachmentId;

    @TableField("gender")
    @Schema(description = "性别：0-保密，1-男，2-女")
    private Integer gender;

    @TableField("phone")
    @Schema(description = "手机号")
    private String phone;

    @TableField("email")
    @Schema(description = "邮箱")
    @Email(message = "邮箱格式不正确")
    private String email;

    @TableField("theme")
    @Schema(description = "个性签名/简介")
    private String theme;

    @TableField("status")
    @Schema(description = "账号状态：0-禁用，1-正常")
    private Integer status;

    @TableField("role_level")
    @Schema(description = "用户角色")
    private Integer roleLevel;

    /**
     * 验证码
     */
    @NotBlank(message = "验证码不能为空")
    @TableField(exist = false)
    private String code;


}

